package ink.lovejinhu.leetcode;

import org.junit.Test;

/**
 * @author jinhu
 * created 2021-05-06 10:21
 */
public class Solution_0058 {
    public int lengthOfLastWord(String s) {
        String[] temp = s.split(" ");
        if (temp.length == 0) {
            return 0;
        } else {
            return temp[temp.length - 1].length();
        }

    }

    @Test
    public void test() {
        String s = "Hello World";
        int i = this.lengthOfLastWord(s);
        System.out.println(i);
    }
}
